<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 *
 * @package     anime
 * @author      Do Ngoc Son (ngocson2306@gmail.com)
 * @copyright   PHP TEAM
 * @link        http://phpandmysql.net
 * @since       Version 1.0
 * @phone       0982644370
 *
 */
class Media_model extends MY_Model{
	public $table = 'media';
	public $key   = 'idmedia';
	public function __construct(){
		parent:: __construct();
		
	}

  public function save($id=false,$data=array()){
  	if(!$id){
  		$this->insert($data);
  	}
  	$result = $this->update($id,$data);
  	if($result){
  		return $id;
  	}
  	return false;
  }

  public function get_data_media(){
    $param_cate           = array();
    $param_cate['select'] = array('idmedia','name','thumb','rewrite');
    $param_cate['where']  = array('status' => 1);
    return  $this->get_list($param_cate);
  }

  public function slider_video(){
    $param           = array();
    $param['select'] = array('idmedia','thumb','rewrite','name');
    $param['where']  = array('status' => 1);
    $param['order']  = array('idmedia','DESC');
    $param['limit']  = array(7);
    return $this->get_list($param);
  }

}